package com.icoolkj.ms.api.auth.feign;

import com.icoolkj.ms.api.auth.bo.UserInfoInTokenBO;
import com.icoolkj.ms.api.auth.dto.AccountRegisterDTO;
import com.icoolkj.ms.api.auth.vo.TokenInfoVO;
import com.icoolkj.ms.common.core.constant.ServiceNameConstants;
import com.icoolkj.ms.common.core.feign.FeignInsideAuthConfig;
import com.icoolkj.ms.common.core.response.ServerResponseEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @author icoolkj
 * @version 1.0
 * @description
 * @createDate 2025/02/19 10:56
 */
@FeignClient(value = ServiceNameConstants.AUTH_SERVICE, contextId = "account")
public interface AccountRegisterFeignClient {

    /**
     * 保存统一账户
     * @param accountRegisterDTO 账户信息
     * @return Long uid
     */
    @PostMapping(value = FeignInsideAuthConfig.FEIGN_INSIDE_URL_PREFIX + "/insider/account/saveUserRegister")
    ServerResponseEntity<Long> saveUserRegister(@RequestBody AccountRegisterDTO accountRegisterDTO);

    /**
     * 保存用户信息，生成token，返回前端
     * @param userInfoInTokenBO 账户信息 和社交账号信息
     * @return tokenInfoVO
     */
    @PostMapping(value = FeignInsideAuthConfig.FEIGN_INSIDE_URL_PREFIX + "/insider/storeTokenAndGetVo")
    ServerResponseEntity<TokenInfoVO> storeTokenAndGetVo(@RequestBody UserInfoInTokenBO userInfoInTokenBO);
}
